package com.kilon.workfaq.service.write.impl;

import com.kilon.workfaq.entity.ImagePo;
import com.kilon.workfaq.mapper.write.ImageWriteMapper;
import com.kilon.workfaq.service.write.ImageWriteService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 图片表(Image)表服务实现类
 *
 * @author makejava
 * @since 2023-02-22 23:24:10
 */
@Service("imageWriteService")
public class ImageWriteServiceImpl implements ImageWriteService {
    @Resource
    private ImageWriteMapper imageWriteMapper;

    /**
     * 新增数据
     *
     * @param image 实例对象
     * @return 实例对象
     */
    @Override
    public ImagePo insert(ImagePo image) {
        this.imageWriteMapper.insert(image);
        return image;
    }

    /**
     * 修改数据
     *
     * @param image 实例对象
     * @return 实例对象
     */
    @Override
    public boolean update(ImagePo image) {
        return this.imageWriteMapper.update(image) == 1;
    }

    /**
     * 通过主键删除数据
     *
     * @return 是否成功
     */
    @Override
    public boolean deleteById(ImagePo image) {
        return this.imageWriteMapper.deleteById(image.getId()) == 1;
    }
}
